/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package glamourbeautyclinic.personel;



import java.awt.Dimension;
import java.awt.Toolkit;
import images.GlamourImage;
import java.awt.Frame;
import java.awt.Point;
import java.util.Vector;
import javax.swing.DefaultListModel;
import javax.swing.JDesktopPane;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;
import javax.swing.ListModel;
import javax.swing.RowSorter;
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;
import util.DBConnection;




/**
 *
 * @author anh
 */
public class FrmStaff extends javax.swing.JInternalFrame {
    //Declare for EVERY form
    GlamourImage GI = new GlamourImage();
    DBConnection dc;
    //Declare for CONCRETE form
    
    
    /**
     * Creates new form frmSearchCustomer
     */
    public FrmStaff(DBConnection dc) {
        //this.setContentPane(new ImageBackgroundPanel(new ImageIcon(GI.getClass().getResource("Frame.png"))));
        initComponents();
        this.dc =dc;
        GI.addIconFor(this);
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        // Can be resize height parameter to proper scale
        this.setLocation((screenSize.width - this.getWidth()) / 2-100, 10);
        RowSorter<TableModel> sorter = new TableRowSorter<TableModel>(tblStaff.getModel());
        tblStaff.setRowSorter(sorter);
        tblStaff.setComponentPopupMenu(pmnStaff);
    }


    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pmnStaff = new javax.swing.JPopupMenu();
        mniNew = new javax.swing.JMenuItem();
        mniUpdate = new javax.swing.JMenuItem();
        mniAddSpec = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        mniSelectAll = new javax.swing.JMenuItem();
        mniDeselect = new javax.swing.JMenuItem();
        mniLock = new javax.swing.JMenuItem();
        mniUnlock = new javax.swing.JMenuItem();
        grpFilter = new javax.swing.ButtonGroup();
        pnlLookup = new javax.swing.JPanel();
        radStaffID = new javax.swing.JRadioButton();
        radStaffName = new javax.swing.JRadioButton();
        txtStaffIDFilter = new javax.swing.JTextField();
        txtStaffNameFilter = new javax.swing.JTextField();
        chkActiveFilter = new javax.swing.JCheckBox();
        btnSearch = new javax.swing.JButton();
        btnFindAll = new javax.swing.JButton();
        jSeparator = new javax.swing.JSeparator();
        btnSelectAll = new javax.swing.JButton();
        btnDeselect = new javax.swing.JButton();
        btnLock = new javax.swing.JButton();
        btnUnlock = new javax.swing.JButton();
        btnPopup = new javax.swing.JButton();
        jspStaff = new javax.swing.JScrollPane();
        tblStaff = new javax.swing.JTable();
        lblStaffFound = new javax.swing.JLabel();
        lblSpec = new javax.swing.JLabel();
        jspSpec = new javax.swing.JScrollPane();
        lstSpec = new javax.swing.JList();
        btnAddSpec = new javax.swing.JButton();
        btnDeleteSpec = new javax.swing.JButton();
        pnlDetails = new javax.swing.JPanel();
        btnInsert = new javax.swing.JButton();
        btnUpdate = new javax.swing.JButton();
        pnlDetailsChild = new javax.swing.JPanel();
        lblStaffID = new javax.swing.JLabel();
        lblRequired1 = new javax.swing.JLabel();
        txtStaffID = new javax.swing.JTextField();
        lblStaffName = new javax.swing.JLabel();
        lblRequired2 = new javax.swing.JLabel();
        txtStaffName = new javax.swing.JTextField();
        lblAddr = new javax.swing.JLabel();
        lblRequired3 = new javax.swing.JLabel();
        txtAddr = new javax.swing.JTextField();
        lblStatus = new javax.swing.JLabel();
        lblRequired4 = new javax.swing.JLabel();
        chkActive = new javax.swing.JCheckBox();
        chkLock = new javax.swing.JCheckBox();
        lblPic = new javax.swing.JLabel();
        btnAddPic = new javax.swing.JButton();
        lblDetailsMsg = new javax.swing.JLabel();
        btnSave = new javax.swing.JButton();
        btnExit = new javax.swing.JButton();

        mniNew.setText("New");
        pmnStaff.add(mniNew);

        mniUpdate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Update.png"))); // NOI18N
        mniUpdate.setText("Update");
        pmnStaff.add(mniUpdate);

        mniAddSpec.setText("New specialist");
        pmnStaff.add(mniAddSpec);
        pmnStaff.add(jSeparator1);

        mniSelectAll.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/SelectAll.png"))); // NOI18N
        mniSelectAll.setText("Select all");
        pmnStaff.add(mniSelectAll);

        mniDeselect.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Deselect.png"))); // NOI18N
        mniDeselect.setText("Deselect");
        pmnStaff.add(mniDeselect);

        mniLock.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Lock.png"))); // NOI18N
        mniLock.setText("Lock");
        pmnStaff.add(mniLock);

        mniUnlock.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Lock.png"))); // NOI18N
        mniUnlock.setText("Unlock");
        pmnStaff.add(mniUnlock);

        setClosable(true);
        setIconifiable(true);
        setTitle("Staff management");
        setMaximumSize(new java.awt.Dimension(672, 634));
        setName("Staff"); // NOI18N
        addInternalFrameListener(new javax.swing.event.InternalFrameListener() {
            public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameClosing(javax.swing.event.InternalFrameEvent evt) {
                formInternalFrameClosing(evt);
            }
            public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) {
                formInternalFrameDeiconified(evt);
            }
            public void internalFrameIconified(javax.swing.event.InternalFrameEvent evt) {
                formInternalFrameIconified(evt);
            }
            public void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) {
            }
        });

        pnlLookup.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true), "Search", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12), new java.awt.Color(51, 51, 51))); // NOI18N
        pnlLookup.setOpaque(false);

        radStaffID.setBackground(new java.awt.Color(255, 255, 255));
        grpFilter.add(radStaffID);
        radStaffID.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        radStaffID.setForeground(new java.awt.Color(0, 51, 255));
        radStaffID.setSelected(true);
        radStaffID.setText("Staff ID");
        radStaffID.setBorder(null);
        radStaffID.setBorderPainted(true);
        radStaffID.setFocusPainted(false);
        radStaffID.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        radStaffID.setOpaque(false);
        radStaffID.setPreferredSize(new java.awt.Dimension(43, 20));
        radStaffID.setRolloverEnabled(false);
        radStaffID.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                radStaffIDItemStateChanged(evt);
            }
        });

        radStaffName.setBackground(new java.awt.Color(255, 255, 255));
        grpFilter.add(radStaffName);
        radStaffName.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        radStaffName.setForeground(new java.awt.Color(0, 51, 255));
        radStaffName.setText("Staff name");
        radStaffName.setBorder(null);
        radStaffName.setBorderPainted(true);
        radStaffName.setFocusPainted(false);
        radStaffName.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        radStaffName.setOpaque(false);
        radStaffName.setPreferredSize(new java.awt.Dimension(43, 20));
        radStaffName.setRolloverEnabled(false);

        txtStaffIDFilter.setForeground(new java.awt.Color(0, 102, 51));
        txtStaffIDFilter.setPreferredSize(new java.awt.Dimension(56, 20));

        txtStaffNameFilter.setForeground(new java.awt.Color(0, 102, 51));
        txtStaffNameFilter.setEnabled(false);
        txtStaffNameFilter.setPreferredSize(new java.awt.Dimension(56, 20));

        chkActiveFilter.setForeground(new java.awt.Color(0, 102, 51));
        chkActiveFilter.setSelected(true);
        chkActiveFilter.setText("Active");
        chkActiveFilter.setBorder(null);
        chkActiveFilter.setBorderPainted(true);
        chkActiveFilter.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        chkActiveFilter.setOpaque(false);
        chkActiveFilter.setPreferredSize(new java.awt.Dimension(51, 20));

        btnSearch.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btnSearch.setForeground(new java.awt.Color(0, 51, 51));
        btnSearch.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Search.png"))); // NOI18N
        btnSearch.setMnemonic('S');
        btnSearch.setText("Search");
        btnSearch.setToolTipText("Find staff");
        btnSearch.setBorder(null);
        btnSearch.setContentAreaFilled(false);
        btnSearch.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btnSearch.setMargin(new java.awt.Insets(6, 6, 6, 6));
        btnSearch.setName(""); // NOI18N
        btnSearch.setOpaque(true);
        btnSearch.setPreferredSize(new java.awt.Dimension(59, 22));
        btnSearch.setRolloverEnabled(false);

        btnFindAll.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btnFindAll.setForeground(new java.awt.Color(0, 51, 51));
        btnFindAll.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/SelectAll.png"))); // NOI18N
        btnFindAll.setMnemonic('S');
        btnFindAll.setText("Find All");
        btnFindAll.setToolTipText("Find customer");
        btnFindAll.setBorder(null);
        btnFindAll.setContentAreaFilled(false);
        btnFindAll.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btnFindAll.setMargin(new java.awt.Insets(6, 6, 6, 6));
        btnFindAll.setName(""); // NOI18N
        btnFindAll.setOpaque(true);
        btnFindAll.setPreferredSize(new java.awt.Dimension(59, 22));
        btnFindAll.setRolloverEnabled(false);

        btnSelectAll.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btnSelectAll.setForeground(new java.awt.Color(0, 51, 51));
        btnSelectAll.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/SelectAll.png"))); // NOI18N
        btnSelectAll.setMnemonic('a');
        btnSelectAll.setText("Select all");
        btnSelectAll.setToolTipText("Check all select combo box");
        btnSelectAll.setBorder(null);
        btnSelectAll.setContentAreaFilled(false);
        btnSelectAll.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btnSelectAll.setMargin(new java.awt.Insets(6, 6, 6, 6));
        btnSelectAll.setName(""); // NOI18N
        btnSelectAll.setOpaque(true);
        btnSelectAll.setPreferredSize(new java.awt.Dimension(59, 22));
        btnSelectAll.setRolloverEnabled(false);

        btnDeselect.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btnDeselect.setForeground(new java.awt.Color(0, 51, 51));
        btnDeselect.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Deselect.png"))); // NOI18N
        btnDeselect.setMnemonic('e');
        btnDeselect.setText("Deselect");
        btnDeselect.setToolTipText("Uncheck all select combo box");
        btnDeselect.setBorder(null);
        btnDeselect.setContentAreaFilled(false);
        btnDeselect.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btnDeselect.setMargin(new java.awt.Insets(6, 6, 6, 6));
        btnDeselect.setName(""); // NOI18N
        btnDeselect.setOpaque(true);
        btnDeselect.setPreferredSize(new java.awt.Dimension(59, 22));
        btnDeselect.setRolloverEnabled(false);

        btnLock.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Lock.png"))); // NOI18N
        btnLock.setToolTipText("Lock staff");
        btnLock.setBorderPainted(false);
        btnLock.setContentAreaFilled(false);
        btnLock.setEnabled(false);

        btnUnlock.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Unlock.png"))); // NOI18N
        btnUnlock.setToolTipText("Unlock staff");
        btnUnlock.setBorderPainted(false);
        btnUnlock.setContentAreaFilled(false);
        btnUnlock.setEnabled(false);

        btnPopup.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/001_25.png"))); // NOI18N
        btnPopup.setToolTipText("Insert new service");
        btnPopup.setBorderPainted(false);
        btnPopup.setContentAreaFilled(false);
        btnPopup.setEnabled(false);
        btnPopup.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPopupActionPerformed(evt);
            }
        });

        tblStaff.setForeground(new java.awt.Color(0, 102, 51));
        tblStaff.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, "Kenji Le",  new Boolean(true), null},
                {null, "John Smith", null,  new Boolean(true)},
                {null, "Cahn Marco",  new Boolean(true), null}
            },
            new String [] {
                "Select", "Name", "Active", "Lock"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Boolean.class, java.lang.Object.class, java.lang.Boolean.class, java.lang.Boolean.class
            };
            boolean[] canEdit = new boolean [] {
                true, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tblStaff.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        tblStaff.getTableHeader().setReorderingAllowed(false);
        tblStaff.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                tblStaffMousePressed(evt);
            }
        });
        jspStaff.setViewportView(tblStaff);
        if (tblStaff.getColumnModel().getColumnCount() > 0) {
            tblStaff.getColumnModel().getColumn(0).setPreferredWidth(30);
            tblStaff.getColumnModel().getColumn(1).setPreferredWidth(130);
            tblStaff.getColumnModel().getColumn(2).setPreferredWidth(70);
            tblStaff.getColumnModel().getColumn(3).setPreferredWidth(30);
        }

        lblStaffFound.setForeground(new java.awt.Color(0, 51, 255));
        lblStaffFound.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        lblStaffFound.setText("0 records found");
        lblStaffFound.setPreferredSize(new java.awt.Dimension(38, 20));

        lblSpec.setDisplayedMnemonic('n');
        lblSpec.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lblSpec.setForeground(new java.awt.Color(0, 51, 255));
        lblSpec.setLabelFor(txtStaffID);
        lblSpec.setText("Employee's specialist");
        lblSpec.setPreferredSize(new java.awt.Dimension(38, 20));

        lstSpec.setForeground(new java.awt.Color(0, 102, 51));
        lstSpec.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Hair dye", "Hair cuts", "Waxing" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        lstSpec.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                lstSpecValueChanged(evt);
            }
        });
        jspSpec.setViewportView(lstSpec);

        btnAddSpec.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Insert.png"))); // NOI18N
        btnAddSpec.setToolTipText("Insert new specialist");
        btnAddSpec.setBorderPainted(false);
        btnAddSpec.setContentAreaFilled(false);
        btnAddSpec.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddSpecActionPerformed(evt);
            }
        });

        btnDeleteSpec.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Delete.png"))); // NOI18N
        btnDeleteSpec.setToolTipText("Delete specialist");
        btnDeleteSpec.setBorderPainted(false);
        btnDeleteSpec.setContentAreaFilled(false);
        btnDeleteSpec.setEnabled(false);

        javax.swing.GroupLayout pnlLookupLayout = new javax.swing.GroupLayout(pnlLookup);
        pnlLookup.setLayout(pnlLookupLayout);
        pnlLookupLayout.setHorizontalGroup(
            pnlLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlLookupLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jSeparator)
                    .addGroup(pnlLookupLayout.createSequentialGroup()
                        .addGroup(pnlLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lblStaffFound, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, pnlLookupLayout.createSequentialGroup()
                                .addComponent(btnSelectAll, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(btnDeselect, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(79, 79, 79)
                                .addComponent(btnLock, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnUnlock, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnPopup, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(0, 0, Short.MAX_VALUE))
                            .addComponent(jspStaff, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                        .addGap(18, 18, 18)
                        .addGroup(pnlLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(lblSpec, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jspSpec, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlLookupLayout.createSequentialGroup()
                                .addComponent(btnAddSpec, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnDeleteSpec, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(44, 44, 44)))))
                .addContainerGap())
            .addGroup(pnlLookupLayout.createSequentialGroup()
                .addGap(53, 53, 53)
                .addGroup(pnlLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(radStaffID, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(radStaffName, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtStaffIDFilter, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(txtStaffNameFilter, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(chkActiveFilter, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnFindAll, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(56, Short.MAX_VALUE))
        );

        pnlLookupLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btnFindAll, btnSearch});

        pnlLookupLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btnLock, btnPopup, btnUnlock});

        pnlLookupLayout.setVerticalGroup(
            pnlLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlLookupLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(radStaffID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtStaffIDFilter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(chkActiveFilter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(6, 6, 6)
                .addGroup(pnlLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(radStaffName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtStaffNameFilter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnFindAll, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(pnlLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlLookupLayout.createSequentialGroup()
                        .addGroup(pnlLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnlLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(btnSelectAll, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(btnDeselect, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(btnLock)
                            .addComponent(btnUnlock)
                            .addComponent(btnPopup, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnlLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jspSpec, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                            .addComponent(jspStaff, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(lblSpec, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnAddSpec)
                    .addComponent(btnDeleteSpec)
                    .addComponent(lblStaffFound, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(73, 73, 73))
        );

        pnlLookupLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {btnLock, btnPopup, btnUnlock});

        pnlDetails.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true), "Details infomation", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12), new java.awt.Color(51, 51, 51))); // NOI18N
        pnlDetails.setOpaque(false);

        btnInsert.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btnInsert.setForeground(new java.awt.Color(0, 51, 51));
        btnInsert.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Insert.png"))); // NOI18N
        btnInsert.setMnemonic('x');
        btnInsert.setText("Insert");
        btnInsert.setToolTipText("Save to database");
        btnInsert.setBorder(null);
        btnInsert.setContentAreaFilled(false);
        btnInsert.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btnInsert.setMargin(new java.awt.Insets(6, 6, 6, 6));
        btnInsert.setName(""); // NOI18N
        btnInsert.setOpaque(true);
        btnInsert.setPreferredSize(new java.awt.Dimension(59, 22));
        btnInsert.setRolloverEnabled(false);

        btnUpdate.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btnUpdate.setForeground(new java.awt.Color(0, 51, 51));
        btnUpdate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Update.png"))); // NOI18N
        btnUpdate.setMnemonic('x');
        btnUpdate.setText("Update");
        btnUpdate.setToolTipText("Save to database");
        btnUpdate.setBorder(null);
        btnUpdate.setContentAreaFilled(false);
        btnUpdate.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btnUpdate.setMargin(new java.awt.Insets(6, 6, 6, 6));
        btnUpdate.setName(""); // NOI18N
        btnUpdate.setOpaque(true);
        btnUpdate.setPreferredSize(new java.awt.Dimension(59, 22));
        btnUpdate.setRolloverEnabled(false);

        pnlDetailsChild.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102)));

        lblStaffID.setDisplayedMnemonic('n');
        lblStaffID.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lblStaffID.setForeground(new java.awt.Color(0, 51, 255));
        lblStaffID.setLabelFor(txtStaffID);
        lblStaffID.setText("Staff ID");
        lblStaffID.setPreferredSize(new java.awt.Dimension(38, 20));

        lblRequired1.setForeground(new java.awt.Color(255, 51, 51));
        lblRequired1.setText("(*)");
        lblRequired1.setPreferredSize(new java.awt.Dimension(38, 20));

        txtStaffID.setForeground(new java.awt.Color(0, 102, 51));
        txtStaffID.setEnabled(false);
        txtStaffID.setPreferredSize(new java.awt.Dimension(56, 20));

        lblStaffName.setDisplayedMnemonic('r');
        lblStaffName.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lblStaffName.setForeground(new java.awt.Color(0, 51, 255));
        lblStaffName.setText("Staff name");
        lblStaffName.setPreferredSize(new java.awt.Dimension(38, 20));

        lblRequired2.setForeground(new java.awt.Color(255, 51, 51));
        lblRequired2.setText("(*)");
        lblRequired2.setPreferredSize(new java.awt.Dimension(38, 20));

        txtStaffName.setForeground(new java.awt.Color(0, 102, 51));
        txtStaffName.setEnabled(false);
        txtStaffName.setPreferredSize(new java.awt.Dimension(56, 20));

        lblAddr.setDisplayedMnemonic('r');
        lblAddr.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lblAddr.setForeground(new java.awt.Color(0, 51, 255));
        lblAddr.setText("Address");
        lblAddr.setPreferredSize(new java.awt.Dimension(38, 20));

        lblRequired3.setForeground(new java.awt.Color(255, 51, 51));
        lblRequired3.setText("(*)");
        lblRequired3.setPreferredSize(new java.awt.Dimension(38, 20));

        txtAddr.setForeground(new java.awt.Color(0, 102, 51));
        txtAddr.setEnabled(false);
        txtAddr.setPreferredSize(new java.awt.Dimension(56, 20));

        lblStatus.setDisplayedMnemonic('r');
        lblStatus.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lblStatus.setForeground(new java.awt.Color(0, 51, 255));
        lblStatus.setText("Status");
        lblStatus.setPreferredSize(new java.awt.Dimension(38, 20));

        lblRequired4.setForeground(new java.awt.Color(255, 51, 51));
        lblRequired4.setText("(*)");
        lblRequired4.setPreferredSize(new java.awt.Dimension(38, 20));

        chkActive.setForeground(new java.awt.Color(0, 102, 51));
        chkActive.setText("Active");

        chkLock.setForeground(new java.awt.Color(0, 102, 51));
        chkLock.setText("Lock");

        lblPic.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        btnAddPic.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btnAddPic.setForeground(new java.awt.Color(0, 51, 51));
        btnAddPic.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Insert.png"))); // NOI18N
        btnAddPic.setMnemonic('x');
        btnAddPic.setText("Add picture");
        btnAddPic.setToolTipText("Save to database");
        btnAddPic.setBorder(null);
        btnAddPic.setContentAreaFilled(false);
        btnAddPic.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btnAddPic.setMargin(new java.awt.Insets(6, 6, 6, 6));
        btnAddPic.setName(""); // NOI18N
        btnAddPic.setOpaque(true);
        btnAddPic.setPreferredSize(new java.awt.Dimension(59, 22));
        btnAddPic.setRolloverEnabled(false);
        btnAddPic.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddPicActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnlDetailsChildLayout = new javax.swing.GroupLayout(pnlDetailsChild);
        pnlDetailsChild.setLayout(pnlDetailsChildLayout);
        pnlDetailsChildLayout.setHorizontalGroup(
            pnlDetailsChildLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDetailsChildLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlDetailsChildLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(lblStatus, javax.swing.GroupLayout.DEFAULT_SIZE, 71, Short.MAX_VALUE)
                    .addComponent(lblStaffName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(lblAddr, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(lblStaffID, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlDetailsChildLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblRequired1, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblRequired2, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblRequired3, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblRequired4, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlDetailsChildLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtStaffID, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(pnlDetailsChildLayout.createSequentialGroup()
                        .addComponent(chkActive)
                        .addGap(18, 18, 18)
                        .addComponent(chkLock))
                    .addComponent(txtStaffName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(txtAddr, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(pnlDetailsChildLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblPic, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnAddPic, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(31, 31, 31))
        );
        pnlDetailsChildLayout.setVerticalGroup(
            pnlDetailsChildLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDetailsChildLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlDetailsChildLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(pnlDetailsChildLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(pnlDetailsChildLayout.createSequentialGroup()
                            .addGap(114, 114, 114)
                            .addComponent(btnAddPic, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(lblPic, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pnlDetailsChildLayout.createSequentialGroup()
                        .addGroup(pnlDetailsChildLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblStaffID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblRequired1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtStaffID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(pnlDetailsChildLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblStaffName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblRequired2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtStaffName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(pnlDetailsChildLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblAddr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblRequired3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtAddr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(pnlDetailsChildLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnlDetailsChildLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(lblStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(lblRequired4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(pnlDetailsChildLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(chkActive)
                                .addComponent(chkLock)))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        lblDetailsMsg.setForeground(new java.awt.Color(255, 51, 51));
        lblDetailsMsg.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblDetailsMsg.setText("Staff name  can not be blank.");
        lblDetailsMsg.setPreferredSize(new java.awt.Dimension(38, 20));

        btnSave.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btnSave.setForeground(new java.awt.Color(0, 51, 51));
        btnSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Save.png"))); // NOI18N
        btnSave.setMnemonic('x');
        btnSave.setText("Save");
        btnSave.setToolTipText("Save to database");
        btnSave.setBorder(null);
        btnSave.setContentAreaFilled(false);
        btnSave.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btnSave.setEnabled(false);
        btnSave.setMargin(new java.awt.Insets(6, 6, 6, 6));
        btnSave.setName(""); // NOI18N
        btnSave.setOpaque(true);
        btnSave.setPreferredSize(new java.awt.Dimension(59, 22));
        btnSave.setRolloverEnabled(false);

        javax.swing.GroupLayout pnlDetailsLayout = new javax.swing.GroupLayout(pnlDetails);
        pnlDetails.setLayout(pnlDetailsLayout);
        pnlDetailsLayout.setHorizontalGroup(
            pnlDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDetailsLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pnlDetailsChild, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(pnlDetailsLayout.createSequentialGroup()
                        .addComponent(btnInsert, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlDetailsLayout.createSequentialGroup()
                        .addComponent(lblDetailsMsg, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnSave, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        pnlDetailsLayout.setVerticalGroup(
            pnlDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDetailsLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnInsert, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pnlDetailsChild, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnSave, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblDetailsMsg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        btnExit.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btnExit.setForeground(new java.awt.Color(0, 51, 51));
        btnExit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/quit.png"))); // NOI18N
        btnExit.setMnemonic('x');
        btnExit.setText("Exit");
        btnExit.setToolTipText("Close window");
        btnExit.setBorder(null);
        btnExit.setContentAreaFilled(false);
        btnExit.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btnExit.setMargin(new java.awt.Insets(6, 6, 6, 6));
        btnExit.setName(""); // NOI18N
        btnExit.setOpaque(true);
        btnExit.setPreferredSize(new java.awt.Dimension(59, 22));
        btnExit.setRolloverEnabled(false);
        btnExit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnExitActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(pnlLookup, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pnlDetails, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnExit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(227, 227, 227))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnlLookup, javax.swing.GroupLayout.PREFERRED_SIZE, 268, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pnlDetails, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnExit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void tblStaffMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblStaffMousePressed
        // TODO add your handling code here:
    }//GEN-LAST:event_tblStaffMousePressed

    private void radStaffIDItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_radStaffIDItemStateChanged
        if(radStaffID.isSelected())
        JOptionPane.showMessageDialog(this, "Handle event here.");
    }//GEN-LAST:event_radStaffIDItemStateChanged

    private void btnPopupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPopupActionPerformed
//        JDesktopPane desk = getDesktopPane();
//        JInternalFrame dlgRelApp = new FrmStaffApp(dc,this);
//        desk.add(dlgRelApp);
//        dlgRelApp.setVisible(true);

    }//GEN-LAST:event_btnPopupActionPerformed

    private void btnAddPicActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddPicActionPerformed
        JFileChooser file = new JFileChooser();
        file.showOpenDialog(this);
        JOptionPane.showMessageDialog(this, file.getSelectedFile().getPath());
    }//GEN-LAST:event_btnAddPicActionPerformed

    private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExitActionPerformed
        this.dispose();
    }//GEN-LAST:event_btnExitActionPerformed

    private void lstSpecValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstSpecValueChanged
        int countItemSelected = lstSpec.getSelectedIndices().length;
        
        if(countItemSelected != 0)
            btnDeleteSpec.setEnabled(true);
        else
            btnDeleteSpec.setEnabled(false);
    }//GEN-LAST:event_lstSpecValueChanged

    private void btnAddSpecActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddSpecActionPerformed
        JDesktopPane desk = getDesktopPane();
        JInternalFrame[] j = desk.getAllFrames();
        for (int i = 0; i < j.length; i++) {
            j[i].setVisible(false);
        }
        
        ListModel spec = lstSpec.getModel();
        JInternalFrame fSpec = new FrmSpecialist(dc,spec);
        fSpec.setVisible(true);
        getDesktopPane().add(fSpec);
        
    }//GEN-LAST:event_btnAddSpecActionPerformed

    private void formInternalFrameIconified(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameIconified
        JDesktopPane desk = getDesktopPane();
        JInternalFrame[] j = desk.getAllFrames();

        for (int i = 0; i < j.length; i++) {
            if ("StaffApp".equals(j[i].getName()))
            j[i].setVisible(false);
        }
    }//GEN-LAST:event_formInternalFrameIconified

    private void formInternalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameDeiconified
        JDesktopPane desk = getDesktopPane();
        JInternalFrame[] j = desk.getAllFrames();

        for (int i = 0; i < j.length; i++) {
            if ("StaffApp".equals(j[i].getName()))
            j[i].setVisible(true);
        }
    }//GEN-LAST:event_formInternalFrameDeiconified

    private void formInternalFrameClosing(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameClosing
        JDesktopPane desk = getDesktopPane();
        JInternalFrame[] j = desk.getAllFrames();

        for (int i = 0; i < j.length; i++) {
            if ("StaffApp".equals(j[i].getName()))
            j[i].dispose();
        }
    }//GEN-LAST:event_formInternalFrameClosing

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAddPic;
    private javax.swing.JButton btnAddSpec;
    private javax.swing.JButton btnDeleteSpec;
    private javax.swing.JButton btnDeselect;
    private javax.swing.JButton btnExit;
    private javax.swing.JButton btnFindAll;
    private javax.swing.JButton btnInsert;
    private javax.swing.JButton btnLock;
    private javax.swing.JButton btnPopup;
    private javax.swing.JButton btnSave;
    private javax.swing.JButton btnSearch;
    private javax.swing.JButton btnSelectAll;
    private javax.swing.JButton btnUnlock;
    private javax.swing.JButton btnUpdate;
    private javax.swing.JCheckBox chkActive;
    private javax.swing.JCheckBox chkActiveFilter;
    private javax.swing.JCheckBox chkLock;
    private javax.swing.ButtonGroup grpFilter;
    private javax.swing.JSeparator jSeparator;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JScrollPane jspSpec;
    private javax.swing.JScrollPane jspStaff;
    private javax.swing.JLabel lblAddr;
    private javax.swing.JLabel lblDetailsMsg;
    private javax.swing.JLabel lblPic;
    private javax.swing.JLabel lblRequired1;
    private javax.swing.JLabel lblRequired2;
    private javax.swing.JLabel lblRequired3;
    private javax.swing.JLabel lblRequired4;
    private javax.swing.JLabel lblSpec;
    private javax.swing.JLabel lblStaffFound;
    private javax.swing.JLabel lblStaffID;
    private javax.swing.JLabel lblStaffName;
    private javax.swing.JLabel lblStatus;
    private javax.swing.JList lstSpec;
    private javax.swing.JMenuItem mniAddSpec;
    private javax.swing.JMenuItem mniDeselect;
    private javax.swing.JMenuItem mniLock;
    private javax.swing.JMenuItem mniNew;
    private javax.swing.JMenuItem mniSelectAll;
    private javax.swing.JMenuItem mniUnlock;
    private javax.swing.JMenuItem mniUpdate;
    private javax.swing.JPopupMenu pmnStaff;
    private javax.swing.JPanel pnlDetails;
    private javax.swing.JPanel pnlDetailsChild;
    private javax.swing.JPanel pnlLookup;
    private javax.swing.JRadioButton radStaffID;
    private javax.swing.JRadioButton radStaffName;
    private javax.swing.JTable tblStaff;
    private javax.swing.JTextField txtAddr;
    private javax.swing.JTextField txtStaffID;
    private javax.swing.JTextField txtStaffIDFilter;
    private javax.swing.JTextField txtStaffName;
    private javax.swing.JTextField txtStaffNameFilter;
    // End of variables declaration//GEN-END:variables
}
